package com.hzjq.fxlib.presenter

import android.graphics.Color
import android.graphics.drawable.GradientDrawable
import android.view.ViewGroup
import com.hzjq.fxlib.R
import com.wxl.common.util.DPUtil
import kotlinx.android.synthetic.main.layout_register_progress.view.*

class RegisterProgressPresenter : AbsViewPresenter {

    constructor(rootView: ViewGroup) : super(rootView)

    override fun onContentViewId(): Int {
        return R.layout.layout_register_progress
    }

    override fun onResume() {
        childView.registerCapProgressBar.startDraw()
        childView.registerCapProgressBar.setColor("#8899cc00")
        (rootView.registerCapLineView.background as GradientDrawable).setStroke(
            DPUtil.dip2px(2),
            Color.parseColor("#8899cc00"))
    }

    override fun showAction(action: String) {
        childView.registerCapProgressAction.text = action
    }

    override fun hide() {
        childView.registerCapProgressBar.stopDraw()
    }

    override fun notifyProgressBar(action: String, p: Int) {
        childView.registerCapProgressBar.setPercent(p)
        childView.registerCapProgressAction.text = action
    }

}